package com.ruoyi.web.controller.travel;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.travel.domain.TravelOrderFollow;
import com.ruoyi.travel.service.ITravelOrderFollowService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

@RestController
@RequestMapping("/travel/follow")
public class TravelOrderFollowController extends BaseController
{
    @Autowired
    private ITravelOrderFollowService travelOrderFollowService;

    @PreAuthorize("@ss.hasPermi('travel:follow:list')")
    @GetMapping("/listAll")
    public AjaxResult listAll(TravelOrderFollow travelOrderFollow)
    {
        List<TravelOrderFollow> list = travelOrderFollowService.selectTravelOrderFollowList(travelOrderFollow);
        return success(list);
    }

    /**
     * 查询跟进列表
     */
    @PreAuthorize("@ss.hasPermi('travel:follow:list')")
    @GetMapping("/list")
    public TableDataInfo list(TravelOrderFollow travelOrderFollow)
    {
        startPage();
        List<TravelOrderFollow> list = travelOrderFollowService.selectTravelOrderFollowList(travelOrderFollow);
        return getDataTable(list);
    }

    /**
     * 获取跟进详细信息
     */
    @PreAuthorize("@ss.hasPermi('travel:follow:query')")
    @GetMapping(value = "/{orderFollowId}")
    public AjaxResult getInfo(@PathVariable("orderFollowId") Long orderFollowId)
    {
        return success(travelOrderFollowService.selectTravelOrderFollowByOrderFollowId(orderFollowId));
    }

    /**
     * 新增跟进
     */
    @PreAuthorize("@ss.hasPermi('travel:follow:add')")
    @Log(title = "跟进", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TravelOrderFollow travelOrderFollow)
    {
        return toAjax(travelOrderFollowService.insertTravelOrderFollow(travelOrderFollow));
    }


}
